//
//  CooperationCaseViewController.m
//  AnXin100
//
//  Created by 王合润 on 10/23/18.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "CooperationCaseViewController.h"
#import "SDCycleScrollView.h"
#import "CooperationCaseTableViewCell.h"
@interface CooperationCaseViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *mainTable;
@property (nonatomic, strong) SDCycleScrollView *tableHeadImage;

@end

@implementation CooperationCaseViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    [PublicMonMethods setupNavigationItems:self];
    [PublicMonMethods settitle:@"合作案例" viewController:self];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.mainTable];
}


#pragma lazy load
- (UITableView *)mainTable {
    if (!_mainTable) {
        
        _mainTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain];
        _mainTable.delegate = self;
        _mainTable.dataSource = self;
        _mainTable.separatorStyle = UITableViewCellSeparatorStyleNone;
        _mainTable.tableHeaderView = self.tableHeadImage;
        [_mainTable registerNib:[UINib nibWithNibName:@"CooperationCaseTableViewCell" bundle:nil] forCellReuseIdentifier:@"CooperationCaseTableViewCell"];
        
    }
    return _mainTable;
}

- (SDCycleScrollView *)tableHeadImage {
    if (!_tableHeadImage) {
        NSArray *imageNames = @[@"m1.jpeg",
                                @"m2.jpeg",
                                @"m3.jpeg",
                                @"m4.jpeg",
                                @"m5.jpeg" // 本地图片请填写全名
                                ];
        _tableHeadImage = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 180) shouldInfiniteLoop:YES imageNamesGroup:imageNames];
        _tableHeadImage.delegate = self;
        _tableHeadImage.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
        _tableHeadImage.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    }
    return _tableHeadImage;
}

#pragma mark - UITableView Delegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 114;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    CooperationCaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CooperationCaseTableViewCell"];
    return cell;
}

- (void)backAction:(UIBarButtonItem *)item {
    [self.navigationController popViewControllerAnimated:YES];
}


@end
